﻿using System;
using EasyStep.Attributes;using EasyStep.TestExecution.Data;using EasyStep.TestExecution.Interfaces;

using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.Common.UnitTesting;


namespace EasyStep.TestActions.Actions
{
    [TestAction(typeof(AssertAction), Name = "ByXpath", RequireData = false)]
    class AssertByXpath : ITestAction<Manager>
    {

        public void Execute(Manager browser, TestStepResult data, IExecuteDataContext context)
        {
            var c = new HtmlControl(browser.ActiveBrowser.Find.ByXPath(data.Locator));
            if (c == null) throw new ArgumentNullException("can't find element by xpath:" + data.Locator);
            Assert.IsTrue(c.IsVisible());
        }
    }
}